﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Singleton
{
    class Cache
    {
        private static Cache cache;
        private Dictionary<string, string> dictionary;
        private readonly static Object padlock = new Object();
        public static Cache Instance
        {
            get
            {
                if (cache == null)
                {
                    lock (padlock)
                    {
                        cache = new Cache();
                    }
                }
                return cache;
            }
        }

        private Cache()
        {
            dictionary = new Dictionary<string, string>();
            dictionary.Add("key", "value");
            dictionary.Add("key1", "value1");
        }


        public string Item(string key)
        {
            return dictionary[key];
        }
    }
}
